package com.wedata.weimob;

import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;

import java.util.Date;

public class 微盟分销业务_测试 {

    public static void main(String[] args) {
        财务对账单();
    }
    public static void getList(){
        JSONObject body = new JSONObject();
        body.set("pageNum",1);
        body.set("pageSize",10);
        body.set("vid","6001490628846");
        //body.put("vidType", 10);

        String resultStr = HttpUtil.post("https://dopen.weimob.com/apigw/weimob_distribution/v2.0/reward/order/getList?accesstoken="+微盟分销业务.postRequestWithSign(), body.toString());
        System.out.println(resultStr);
    }
    public static void 财务对账单(){
        JSONObject body = new JSONObject();
        body.set("pageNum",1);
        body.set("pageSize",10);
        body.set("payTime","2025-04-13");

        String resultStr = HttpUtil.post("https://dopen.weimob.com/apigw/bos/v2.0/finance/bill/transaction/get?accesstoken="+微盟分销业务.postRequestWithSign(), body.toString());
        System.out.println(resultStr);
    }

    public static void getUserSuperWid(){
        JSONObject body = new JSONObject();
        body.set("wid",10956917846L);
        String resultStr = HttpUtil.post("https://dopen.weimob.com/apigw/bos/v2.0/user/superwid/get?accesstoken="+微盟分销业务.postRequestWithSign(), body.toString());
        System.out.println(resultStr);
    }
    /**
     * 获取订单列表(分销)
     */
    public static void getOrderList(){
        JSONObject body = new JSONObject();
        body.set("source",10);//渠道来源类型：0-微信公众号；1-微信小程序；2-微信unionid；4-手机号。
        body.set("appId","03F672FFD28D38F0F30A9DCD909A0061");//应用 appid，例如公众号 appid 或小程序 appid。如果是手机号或 unionid，则传入 default。
        body.set("originalId","3");//渠道内的关联字段，比如微信是 openid，手机号渠道对应手机号
        //body.set("wid","10898133920");//用户wid

        String resultStr = HttpUtil.post("https://dopen.weimob.com/apigw/bos/v2.0/weimob_distribution/reward/order/get?accesstoken="+微盟分销业务.postRequestWithSign(), body.toString());
        System.out.println(resultStr);
    }

    /**
     * 查询订单列表（微盟所有订单）
     */
    public static void getAllOrderList(){
        JSONObject body = new JSONObject();
        body.set("pageNum",1);
        body.set("pageSize",10);
        JSONObject queryParameter = new JSONObject();
        Date startDate = DateUtil.parseDate("2024-12-01");
        Date endDate = DateUtil.parseDate("2024-12-03");
        queryParameter.set("queryTime",new JSONObject("{\"startTime\":"+startDate.getTime()+",\"endTime\":"+endDate.getTime()+",\"type\":0}"));
        //queryParameter.set("parentOrderNo","4944976102599610079");
        body.set("queryParameter",queryParameter);

        String resultStr = HttpUtil.post("https://dopen.weimob.com/apigw/weimob_shop/v2.0/order/list/search?accesstoken="+微盟分销业务.postRequestWithSign(), body.toString());
        System.out.println(resultStr);
    }

    /**
     * 获取主wid
     */
    public static void getSuperwid(){
        JSONObject body = new JSONObject();
        body.set("source",10);//渠道来源类型：0-微信公众号；1-微信小程序；2-微信unionid；4-手机号。
        body.set("appId","03F672FFD28D38F0F30A9DCD909A0061");//应用 appid，例如公众号 appid 或小程序 appid。如果是手机号或 unionid，则传入 default。
        body.set("originalId","3");//渠道内的关联字段，比如微信是 openid，手机号渠道对应手机号
        //body.set("wid","10898133920");//用户wid

        String resultStr = HttpUtil.post("https://dopen.weimob.com/apigw/bos/v2.0/user/superwid/get?accesstoken="+微盟分销业务.postRequestWithSign(), body.toString());
        System.out.println(resultStr);
    }

    private static void yy(){
        微盟分销业务.userChannelList("2943537479");
        /*微盟分销业务. getUserInfo("13670279423","");
        微盟分销业务.importCustomer();
        微盟分销业务. getUserInfo("13670279423","");
        微盟分销业务.userChannelList("2943537479");*/
        //微盟分销业务.userUnBind("10898133920");
        //微盟分销业务.userBind();
        //微盟分销业务.userChannelList("10898133920");

        /*微盟分销业务. getDistributorStatus();
        微盟分销业务.freezeDistributorList();
        微盟分销业务. getDistributorStatus();
        微盟分销业务.unfreezeDistributorList();
        微盟分销业务. getDistributorStatus();*/

        //{"globalTicket":"9929-1703215638.040-saas-w1-724-7689582017","code":{"errcode":0,"errmsg":"响应成功"},"data":{"bosId":4002554743846,"superWid":10821153769}}
        //getSuperwid();
        //微盟分销业务.userChannelList("10908561720");
        //微盟分销业务.userChannelList("3100912391");
        //微盟分销业务.userBind();
        //微盟分销业务.userChannelList("10821153769");
        /*微盟分销业务.userChannelList("10911926007");*/
        //微盟分销业务.importCustomer();
        //微盟分销业务.userChannelList("3080619661");
        //微盟分销业务.updatePhone();
        //微盟分销业务. getUserInfo("13787128818","");
        //微盟分销业务.updateCustomer("10911117484","林韵涵");
    }

}
